package com.hqyj.javaSpringBoot.modules.common.entiy;

public class SearchBean {
    //给当前页和条数一个默认值，用final修饰表示常量，常量名一般大写
    private final static int DEFAULT_CURRENT_PAGE=1;
    private final static int DEFAULT_PAGE_SIZE=5;

    //当前页
    private int currentPage;
    //每页显示的条数
    private int pageSize;
    //排序的对象
    private String orderBy;
    //排序的指向，正序，倒叙
    private String direction;
    //搜索的关键字
    private String keyWord;


    //初始化方法
    public void initSerchBean(){
        if (this==null){
            this.setCurrentPage(this.getCurrentPage()==0?DEFAULT_CURRENT_PAGE:this.getCurrentPage());
            this.setPageSize(this.getPageSize()==0?DEFAULT_PAGE_SIZE:this.getPageSize());
        }
    }

    public int getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    public String getKeyWord() {
        return keyWord;
    }

    public void setKeyWord(String keyWord) {
        this.keyWord = keyWord;
    }
}
